package com.example.springbootmbyatisautogenerate.plugin;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

@JsonFormat(
    shape = JsonFormat.Shape.OBJECT
)
public class Page<E> implements List<E> {
    @JsonFormat(
        shape = JsonFormat.Shape.NUMBER
    )
    private final Integer totalCount;
    @JsonFormat(
        shape = JsonFormat.Shape.NUMBER
    )
    private final Integer currPage;
    @JsonFormat(
        shape = JsonFormat.Shape.NUMBER
    )
    private final Integer pageSize;
    @JsonFormat(
        shape = JsonFormat.Shape.ANY
    )
    private final List<E> result;

    public Page(Integer totalCount, Integer currPage, Integer pageSize, List<E> result) {
        this.totalCount = totalCount;
        this.currPage = currPage;
        this.pageSize = pageSize;
        this.result = result;
    }

    public Integer getTotalCount() {
        return this.totalCount;
    }

    public Integer getCurrPage() {
        return this.currPage;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public List<E> getResult() {
        return this.result;
    }

    public int size() {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean isEmpty() {
        return this.result.isEmpty();
    }

    public boolean contains(Object o) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public Iterator<E> iterator() {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public Object[] toArray() {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public <T> T[] toArray(T[] a) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean add(E e) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean remove(Object o) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean containsAll(Collection<?> c) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean addAll(Collection<? extends E> c) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean addAll(int index, Collection<? extends E> c) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean removeAll(Collection<?> c) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public boolean retainAll(Collection<?> c) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public void clear() {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public E get(int index) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public E set(int index, E element) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public void add(int index, E element) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public E remove(int index) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public int indexOf(Object o) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public int lastIndexOf(Object o) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public ListIterator<E> listIterator() {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public ListIterator<E> listIterator(int index) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }

    public List<E> subList(int fromIndex, int toIndex) {
        throw new UnsupportedOperationException("分页对象不支持此操作");
    }
}